﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Xsl;
using System.Xml;

namespace XmlDSigEx
{
    class XPathContext:XsltContext
    {
        private XmlElement _element;

        internal XPathContext(NameTable nt, XmlElement element)
            : base(nt)
        {
            _element = element;
        }

        public override int CompareDocument(string baseUri, string nextbaseUri)
        {
            return 0;
        }

        public override bool PreserveWhitespace(System.Xml.XPath.XPathNavigator node)
        {
            return true;
        }

        public override IXsltContextFunction ResolveFunction(string prefix, string name, System.Xml.XPath.XPathResultType[] ArgTypes)
        {
            if (prefix == "" && name == "here")
                return new XPathHereFunction(_element);
            return null;
        }

        public override IXsltContextVariable ResolveVariable(string prefix, string name)
        {
            return null;
        }

        public override bool Whitespace
        {
            get { return true; }
        }
    }
}
